package com.bijava.controller;

import com.bijava.model.TaskJobVO;
import com.bijava.service.ElasticJobService;
import com.bijava.taskjob.MySimpleJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author bijava
 * @version 1.0
 * @since 20-8-21
 */
@RestController
@RequestMapping("/monitor")
public class ElasticJobController {
    @Autowired
    private ElasticJobService elasticJobService;

    @PostMapping("/simplejob")
    public String addJob(@RequestBody TaskJobVO taskJobVO) {
        elasticJobService.addSimpleJob(taskJobVO,new MySimpleJob());
        return "success";
    }
}